using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using NTTHAO.Web.BL.CommonPage;
using NTTHAO.CommonWeb;

public partial class Sites_Vigor_Webparts_Pages_Default : NTTHAO.CommonWeb.CommonUserControl
{
    public int _MID = -1;
    protected void Page_Load(object sender, EventArgs e)
    {
        this.Session["PAGE_TITLE"] = null;
        this.Session["PAGE_DESCRIPTION"] = null;

        try
        {
            string controlName = string.Empty;
            if (this.GetCurrentPageGroup().LanguageID != LanguageUtility.GetLanguageID())
            {
                LanguageUtility.SetLanguage(this.GetCurrentPageGroup().LanguageID, Request, Response, Session);
            }

            if (Request.QueryString["type"] != null)
            {

                if (Request.QueryString["m"] != null)
                {
                    int.TryParse(Request.QueryString["m"].Trim(), out _MID);
                }
                if (_MID > 0)
                {
                    CommonMenu mmenu = CommonMenu.GetCommonMenu(_MID);
                    if (mmenu != null && mmenu.ViewType == 1 && mmenu.URL.Trim().Length > 0)
                    {
                        controlName = "../" + mmenu.URL;
                    }
                }
            }

            if (controlName == string.Empty)
            {
                controlName = "Home.ascx";
            }

            if (controlName != string.Empty)
            {
                Control ctrl = this.LoadControl(controlName);
                this._Body.Controls.Add(ctrl);
            }
        }
        catch (Exception ex)
        {
            HtmlGenericControl ctrl = new HtmlGenericControl("div");
            ctrl.InnerHtml = "<p>" + ex.Message + "</p><p>" + ex.StackTrace + "</p>";
            this._Body.Controls.Add(ctrl);
        }
    }
}
